package com.lagou.service.impl;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

/**
 * @author czq
 * @date 2020/9/2 22:41
 */
@Service
public class HelloServiceImpl implements HelloService {

    @Override
    public String methodA(String name) {
        try {
            Thread.sleep(sleepTime());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return "methodA: hello " + name;
    }

    @Override
    public String methodB(String name) {
        try {
            Thread.sleep(sleepTime());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return "methodB: hello " + name;
    }

    @Override
    public String methodC(String name) {
        try {
            Thread.sleep(sleepTime());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return "methodC : hello " + name;
    }

    private int sleepTime() {
        return new Random().nextInt(101);
    }
}
